import { createRouter, createWebHistory, createWebHashHistory, RouteRecordRaw } from 'vue-router'
import { useRouter } from 'vue-router';



const routes: Array<RouteRecordRaw> = [
    { // 登录页
        path: "/",
        name: "root",
        redirect: "/login",
        component: () => import('@/pages/login/Login.vue'), // 按需引入,
        children: []
    },
    { // 登录页
        path: '/login',
        name: 'login',
        component: () => import('@/pages/login/Login.vue') // 按需引入
    },
    { // 登录页
        path: '/home',
        // name: '首页',
        name: '首页',
        // redirect: "/SoftList",
        component: () => import('@/pages/home/Home.vue'), // 按需引入
        children: [
            // Logo // 要放在Home里，要不路由会直接跳转
            {
                path: '/logo',
                name: '徽标',
                component: () => import('@/components/Logo.vue'),
                children: []
            },
        ]
    },
    {
        path: '/SoftCollect', // 这儿是 /SoftCollect 下面的第一个/SoftList就不能展示，，不知道为啥？ -- name 不能一样
        name: '软件收集',
        // component: () => import('@/components/NoExist.vue'), // 这样的话，访问下面的路由，都会跳到这个页面
        component: () => import('@/pages/home/Home.vue'), // Home 也，<router-view> 就可以包含在Home页面里！！！
        children: [
            {
                path: '/SoftList', // 上面不是/SoftList就展示不出来，不知道为啥？-- name 不能一样
                name: '软件列表',
                component: () => import('@/pages/soft/SoftList.vue'),
            },
            {
                path: '/SoftDetail',
                name: '软件详情',
                component: () => import('@/components/TransferDemo.vue'),
            },
            {
                path: '/SoftAdd',
                name: '软件添加',
                component: () => import('@/components/StepsDemo.vue'),
            },
            {
                path: '/SoftUpdate',
                name: '软件更新',
                component: () => import('@/components/ListDemo.vue'),
            },
        ]
    },
    {
        path: '/ComponentCollect',
        name: '组件收集',
        component: () => import('@/pages/home/Home.vue'),
        children: [
            {
                path: '/ComponentList',
                name: '组件列表',
                component: () => import('@/components/StatisticDemo.vue'),
            },
            {
                path: '/ComponentDetail',
                name: '组件详情',
                component: () => import('@/components/QRcodeDemo.vue'),
            },
            {
                path: '/ComponentAdd',
                name: '组件添加',
                component: () => import('@/components/Logo.vue'),
            },
            {
                path: '/ComponentUpdate',
                name: '组件更新',
                component: () => import('@/components/TourDemo.vue'),
            },
        ]
    },
    {
        path: '/DependencyCollect',
        name: '依赖收集',
        component: () => import('@/components/LayoutSideRollDemo.vue'), // 这个不能放 Home下面，要不错乱
        children: [
            {
                path: '/DependencyList',
                name: '依赖列表',
                component: () => import('@/components/Logo.vue'),
            },
            {
                path: '/DependencyDetail',
                name: '依赖详情',
                component: () => import('@/components/Logo.vue'),
            },
            {
                path: '/DependencyAdd',
                name: '依赖添加',
                component: () => import('@/components/Logo.vue'),
            },
            {
                path: '/DependencyUpdate',
                name: '依赖更新',
                component: () => import('@/components/Logo.vue'),
            },
            
        ]
    },
    {
        path: '/AntVueComponentCollect',
        name: 'AntVue组件收集',
        component: () => import('@/pages/home/Home.vue'), // 这个不能放 Home下面，要不错乱
        children: [
            {
                path: '/FormDemo',
                name: '查询表单横放',
                component: () => import('@/components/FormDemo.vue'),
            },
            {
                path: '/OtherFormControlsDemo',
                name: '表单控制',
                component: () => import('@/components/OtherFormControlsDemo.vue'),
            },
            {
                path: '/TimeRelatedControlsDemo',
                name: '表单时间控制',
                component: () => import('@/components/TimeRelatedControlsDemo.vue'),
            },
            {
                path: '/SearchResultListDemo',
                name: '查询表单条件收缩',
                component: () => import('@/components/SearchResultListDemo.vue'),
            },
        ]
    }

]

const router = createRouter({
    history: createWebHashHistory(), // createWebHashHistory 路径加#号
    // history: createWebHistory(),
    routes
})


export default router;